From: Colin Walters Date: Sun, 24 Jul 2016 19:00:02 +0000 (-0400) Subject: pull-local: Explicitly unref variant rather than relying on floating X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~49^2~59 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=35008ead771a7b84128a0fb275af3ca9367a3571;p=ostree.git pull-local: Explicitly unref variant rather than relying on floating This shows up as a leak in valgrind; the callee isn't sinking. In general through the power of cleanup attributes we can do explicit cleanup rather than relying on floating refs. Closes: #410 Approved by: giuseppe --- diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c index 7fb6f03a..b6f649f6 100644 --- a/src/ostree/ot-builtin-pull-local.c +++ b/src/ostree/ot-builtin-pull-local.c @@ -132,6 +132,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr } { GVariantBuilder builder; + g_autoptr(GVariant) opts = NULL; g_auto(GLnxConsoleRef) console = { 0, }; glnx_console_lock (&console); @@ -157,8 +158,9 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr if (console.is_tty) progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); + opts = g_variant_ref_sink (g_variant_builder_end (&builder)); if (!ostree_repo_pull_with_options (repo, src_repo_uri, - g_variant_builder_end (&builder), + opts, progress, cancellable, error)) goto out;